package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] array = {"one","two","three"};
        Collection<String> c= new ArrayList<>();
        c.add("1");
        c.add("2");

        for (int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }
        for (String str : array){
            System.out.println(str);
        }
        System.out.println("------------------");

        Iterator<String> it = c.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (String str : c){
            System.out.println(str);
        }
    }
}
